#!/usr/bin/env python
# -*- coding: utf-8 -*-

# @Time     :2020/11/29
# @Author   :Changshu
# @File     :Exercise_504.py

# 504. 七进制数
# 给定一个整数，将其转化为7进制，并以字符串形式输出。

def convertToBase7(num: int) -> str:
	if num==0:
		return '0'
	n=num if num>=0 else -num
	r=[]
	while n!=0:
		b=n%7
		n=n//7
		r.insert(0,str(b))
	s=''.join(r)
	return s if num>=0 else '-'+s

if __name__ == '__main__':
	# num=103
	# num = 7
	# num = -7
	num=0

	print(convertToBase7(num))